import 'package:color_dart/RgbaColor.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:im_flutter_sdk_example/components/a_button/index.dart';
import 'package:im_flutter_sdk_example/jsonserialize/expert/home_data.dart';

import 'main_title.dart';

class MainPage extends StatelessWidget {
  final HomeExpertData item;
  const MainPage({Key key, this.item}) : super(key: key);
  Widget space(Widget child) {
    return Container(
      margin: EdgeInsets.only(right: 6),
      child: child,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          MainTitle(title: '主页'),
          Container(
            color: Colors.white,
            padding: EdgeInsets.symmetric(vertical: 20, horizontal: 16),
            child:
                Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
              Text('擅长领域',
                  style: TextStyle(
                      color: rgba(68, 68, 68, 1),
                      fontSize: 14,
                      fontWeight: FontWeight.w600)),
              Container(
                  margin: EdgeInsets.only(top: 20, bottom: 12),
                  child: Text('${item.fruit}')),
              Row(
                children: [
                  space(
                    AButton.normal(
                        width: 52,
                        height: 17,
                        bgColor: rgba(232, 243, 255, 1),
                        type: 'primary',
                        onPressed: () {},
                        child: Text('航空航天',
                            style: TextStyle(
                                fontSize: 13, color: rgba(42, 125, 250, 1)))),
                  ),
                ],
              )
            ]),
          ),
          Container(
            color: Colors.white,
            padding: EdgeInsets.symmetric(vertical: 20, horizontal: 16),
            child:
                Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
              Text('专家介绍',
                  style: TextStyle(
                      color: rgba(68, 68, 68, 1),
                      fontSize: 14,
                      fontWeight: FontWeight.bold)),
              Container(
                  margin: EdgeInsets.only(top: 20, bottom: 12),
                  child: Html(data: item.intro)),
              // child: Text('${item.intro}',
              // style:
              // TextStyle(color: rgba(68, 68, 68, 1), fontSize: 14))),
            ]),
          ),
          // Container(
          //   color: Colors.white,
          //   padding: EdgeInsets.symmetric(horizontal: 16),
          //   child:
          //       Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
          //     Text('我的实验室-北大物理实验室',
          //         style: TextStyle(
          //             color: rgba(68, 68, 68, 1),
          //             fontSize: 14,
          //             fontWeight: FontWeight.bold)),
          //     Container(
          //         margin: EdgeInsets.only(top: 20, bottom: 12),
          //         child: Column(
          //           children: [
          //             Row(
          //               children: [
          //                 Text('负    责    人：',
          //                     style: TextStyle(
          //                         color: rgba(68, 68, 68, 1), fontSize: 14)),
          //                 Text('张文'),
          //               ],
          //             ),
          //             Padding(padding: EdgeInsets.only(bottom: 17)),
          //             Row(
          //               children: [
          //                 Text('实验室成员：',
          //                     style: TextStyle(
          //                         color: rgba(68, 68, 68, 1), fontSize: 14)),
          //                 Image.asset(
          //                   'lib/assets/images/default_avatar.png',
          //                   width: 26,
          //                   height: 26,
          //                   fit: BoxFit.cover,
          //                 ),
          //                 Padding(padding: EdgeInsets.only(right: 8)),
          //                 Image.asset(
          //                   'lib/assets/images/default_avatar.png',
          //                   width: 26,
          //                   height: 26,
          //                   fit: BoxFit.cover,
          //                 ),
          //               ],
          //             ),
          //           ],
          //         )),
          //   ]),
          // ),
        ],
      ),
    );
  }
}
